const express = require('express');
const router = express.Router();
const{Category } = require('../models');
const{Success,failure} = require('../utils/responses');

router.get('/',async function (req,res,next){

    try{
        const categories= await Category.findAll({
            order:[['rank','ASC'],['id','DESC']]
        });
        Success(res,'查询分类成功',{categories});
    }catch(err){
        failure(res,err);
    }
});
module.exports = router;